<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('每日订单')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                           <!-- <li>
                                <label>关联客户：</label>
                                <input type="text" name="clientIDorderHead"/>
                            </li>
                            <li>
                                <label>订金：</label>
                                <input type="text" name="depositOrderHead"/>
                            </li>-->
                            <li>
                                <label>下单日期：</label>
                                <input type="text" class="time-input" placeholder="请选择下单日期" name="dateOrderHead"/>
                            </li>
                            <!--<li>
                                <label>每日下单总数：</label>
                                <input type="text" name="countOrder"/>
                            </li>
                            <li>
                                <label>每日下单总额：</label>
                                <input type="text" name="allMoney"/>
                            </li>-->
                            <!--<li>
                                <label>交货日期：</label>
                                <input type="text" class="time-input" placeholder="请选择交货日期" name="appointmentDateOrderHead"/>
                            </li>
                            <li>
                                <label>创建订单用户名：</label>
                                <input type="text" name="createStaffIDOrderHead"/>
                            </li>
                            <li>
                                <label>创建订单用户名：</label>
                                <input type="text" name="alterStaffIDOrderHead"/>
                            </li>-->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
               <!-- <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:orderhead:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:orderhead:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:orderhead:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:orderhead:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
                <a class="btn btn-danger" onclick="closeItem()">
                    <i class="fa fa-reply-all"></i> 关闭
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:orderhead:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:orderhead:remove')}]];
        var listFlag = [[${@permission.hasPermi('system:orderhead:list')}]];
        var types = [[${@dict.getType('sys_order_state')}]];
        var prefix = ctx + "system/orderhead";

        $(function() {
            var options = {
                url: prefix + "/getDays",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                daysOrderUrl: prefix + "getDaysOrder",
                queryParams: queryParams,
                modalName: "【请填写功能名称】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'idOrder',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'dateOrderHead',
                    title: '下单日期'
                },
                {
                    field: 'countOrder',
                    title: '每日下单总数'
                },
                {
                    field: 'allMoney',
                    title: '每日下单总价'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="daysOrder(\'' + row.dateOrderHead + '\')"><i class="fa fa-edit"></i>查看详情</a> ');
                       /* actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.idorderHead + '\')"><i class="fa fa-remove"></i>删除</a>');*/
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function queryParams(params) {
            var search = $.table.queryParams(params);
            search.dictType = $("#dictType").val();
            return search;
        }

        function daysOrder(params) {
            console.log(params);
            var dateOrderHead = params
            var url = ctx + "system/orderhead/getDaysOrder/"+dateOrderHead;
            $.modal.openTab("每日订单详情", url);
        }

        /** 关闭选项卡 */
        var closeItem = function(dataId){
            var topWindow = $(window.parent.document);
            if($.common.isNotEmpty(dataId)){
                window.parent.$.modal.closeLoading();
                // 根据dataId关闭指定选项卡
                $('.menuTab[data-id="' + dataId + '"]', topWindow).remove();
                // 移除相应tab对应的内容区
                $('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove();
                return;
            }
            var panelUrl = window.frameElement.getAttribute('data-panel');
            $('.page-tabs-content .active i', topWindow).click();
            if($.common.isNotEmpty(panelUrl)){
                $('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active');
                $('.mainContent .RuoYi_iframe', topWindow).each(function() {
                    if ($(this).data('id') == panelUrl) {
                        $(this).show().siblings('.RuoYi_iframe').hide();
                        return false;
                    }
                });
            }
        }

    </script>
</body>
</html>